// this agent waits for the group creation and then
// adopts the role sweeper and
// commits to the mission garb

{ include("common.asl") }
{ include("check_obl.asl") }

/*
Initial beliefs
*/
myId(1).

!join.

/* Start plans */

/* Initial goals */

/* Garbage plans */
+!goGarb <- .print("Going to garb...").
+!sweep <-    
                            ?myId(MyId);
                            ?garb(X);
							incMyNumberCoallition(MyId);
							goToGarbage(MyId,X);
                            sweepGarbage(X);
                           .print("Sweeping...").
                           
+!organize <- !finish; .print("Organizing...").

+!passCloth <-  
                ?myId(MyId);
                ?garb(X);
				incMyNumberCoallition(MyId);
				goToGarbage(MyId,X);
				removeGarbage(X);
				.print("Passing cloth...").
							
+!cleanCloth <- !finish;
	            .print("Cleaning cloth..").



/* Plans */
// conditions to leave missions
@lgss1[atomic]
+goalState(Scheme,wsecs,_,_,satisfied)
    : .my_name(Me) & commitment(Me,mColaborator,Scheme)
   <- !quit_mission(mColaborator,Scheme).
      
@lgss2[atomic]
+goalState(Scheme,wrefs,_,_,satisfied)
    : .my_name(Me) & commitment(Me,mBib,Scheme)
   <- print("Quiting mission");
   	 !quit_mission(mBib,Scheme).
               